home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!ts28-10
- From: rmorin@inforamp.net (Randy Charles Morin)
- Newsgroups: comp.lang.c++
- Subject: Re: passing filenames by ref
- Date: Tue, 12 Mar 96 04:00:34 GMT
- Organization: MiddleWorld SoftWare
- Message-ID: <4i2sth$nfn@sam.inforamp.net>
- References: <HpARxor+BgbR090yn@delta1.deltanet.com>
- NNTP-Posting-Host: ts28-10.tor.inforamp.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <HpARxor+BgbR090yn@delta1.deltanet.com>,
- tdb@delta1.deltanet.com (Tom D. Baccanti) wrote:
- >I am a new blind student learning c++ and am having some trouble
- >understanding the way to pass in a filename by reference. If I could get a
- >simple example to look at I will understand it better. If this is too basic
- >of a question please disregard. And yes I am using a screen reader and
- >compiling from the dos command line with borland 4.52. Thanks, Tom Baccanti
-
- Most people use char * to represent a string. In this case, passing a string
- by reference makes no sense. In the C++ idiom, you should you a string class,
- like String in the Borland libraries. This class encapsulates the meaning of
- a string allowing you to perform powerful string handling functions like the
- following...
-
- main ()
- {
- string str="Temp";
- if (str.compare("temporary")) return;
- str.append("orary");
- str.to_lower();
- f(str);
- }
-
- void f(string &str)
- {
- if (str.compare("temporary")) return;
- str.to_upper();
- };
-
- I hope this helps.
-
- Agrivar
-